package cn.school.controller;


import cn.school.pojo.Subjects;
import cn.school.service.SubjectsService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.List;

@RestController
@RequestMapping("/subject")
public class SubjectController {
    @Resource
    private SubjectsService subjectsService;
    @RequestMapping("/add")
    public String addSubjects(String subName, HttpServletRequest request){
        String status=subjectsService.addSubjects(subName,request);
        return status;
    }
    @RequestMapping("findList")
    public List<Subjects> findList(){
        List<Subjects> list = subjectsService.findList();
        return list;
    }
    @RequestMapping("delete")
    public String deleteSubjects(String subId, HttpServletRequest request){
        String message = subjectsService.deleteSubjects(subId,request);
        return message;
    }
}
